@extends('admin.public')

@section('content')
    <div class="col-md-12">
        <section class="panel panel-default">
            <header class="panel-heading bg-light no-border">
                <div class="clearfix">
                    <a href="{{ route('index') }}" class="pull-left b-3x m-r logoshow">
                        <img src="{{ config('web_logo') }}" alt="{{ config('set.web_name') }}"
                             style="width: auto;height: 55px">
                    </a>
                    <a href="{{ route('index') }}" class="pull-left b-3x m-r">
                        <img src="{{ config('web_qrcode') }}" alt="{{ config('set.web_name') }}"
                             style="width: auto;height: 55px">
                    </a>
                    <div class="clear">
                        <div class="h3 m-t-xs m-b-xs">
                            {{ config('set.web_name') }}
                            <i class="fa fa-circle text-success pull-right text-xs m-t-sm"></i>
                        </div>
                        <small class="text-muted">{{ subtext(config('set.web_description'),50) }}</small>
                    </div>
                </div>
            </header>
        </section>
    </div>

    <div class="col-md-12">
        <form data-validate="parsley" method="post" enctype="multipart/form-data">
            {!! csrf_field() !!}
            <section class="panel panel-default">
                <header class="panel-heading">
                    {{ $frame['title'] }}
                </header>
                <div class="panel-body">
                    <p class="text-info">请慎重配置网站信息,这些配置会影响到网站的整体质量!</p>
                    <div class="form-group">
                        <label>
                            网站名称
                            {{--<small class="text-small">调用方式: {{ '{' }}{ config('set.web_name') }}</small>--}}
                        </label>
                        <input type="text" class="form-control parsley-validated" data-required="true" name="web_name"
                               value="{{ config('set.web_name') }}" placeholder="请填写网站名称">
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>

                    <div class="form-group">
                        <label>
                            网站网址
                            {{--<small class="text-small">调用方式: {{ '{' }}{ config('set.web_url') }}</small>--}}
                        </label>
                        <input type="text" class="form-control parsley-validated" data-type="url" data-required="true"
                               name="web_url" value="{{ config('set.web_url') }}" placeholder="请填写网站网址">
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>

                    <div class="form-group pull-in clearfix">
                        <div class="col-sm-4">
                            <label>
                                网站Logo
                                {{--<small class="text-small">调用方式: {{ '{' }}{ config('set.web_logo') }}</small>--}}
                            </label>
                            <div class="clearfix"></div>
                            <input type="file" class="filestyle" data-icon="false" data-classButton="btn btn-default"
                                   name="web_logo"
                                   data-classInput="form-control inline v-middle input-s">
                        </div>
                        <div class="col-sm-4">
                            <label>
                                网站ico图标
                                {{--<small class="text-small">调用方式: {{ '{' }}{ config('set.web_ico') }}</small>--}}
                            </label>
                            <div class="clearfix"></div>
                            <input type="file" class="filestyle" data-icon="false" data-classButton="btn btn-default"
                                   name="web_ico"
                                   data-classInput="form-control inline v-middle input-s">
                        </div>
                        <div class="col-sm-4">
                            <label>
                                微信二维码
                                {{--<small class="text-small">调用方式: {{ '{' }}{ config('set.web_qrcode') }}</small>--}}
                            </label>
                            <div class="clearfix"></div>
                            <input type="file" class="filestyle" data-icon="false" data-classButton="btn btn-default"
                                   name="web_qrcode"
                                   data-classInput="form-control inline v-middle input-s">
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>

                    <div class="form-group">
                        <label>
                            网站首页标题
                            {{--<small class="text-small">调用方式: {{ '{' }}{ config('set.web_title') }}</small>--}}
                        </label>
                        <input type="text" class="form-control parsley-validated" data-required="true"
                               name="web_title" value="{{ config('set.web_title') }}" placeholder="请填写网站首页标题">
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>

                    <div class="form-group pull-in clearfix">
                        <div class="col-sm-6">
                            <label>
                                关键词
                                {{--<small class="text-small">调用方式: {{ '{' }}{ config('set.web_keywords') }}</small>--}}
                            </label>
                            <input name="web_keywords" id="tagsinput_web_keywords" class="tagsinput" type="text"
                                   value="{{ config('set.web_keywords') }}"/>
                        </div>
                        <div class="col-sm-6">
                            <label>
                                关键词长尾词
                            </label>
                            <input name="web_keywords_long" id="tagsinput_web_keywords_long" class="tagsinput"
                                   type="text" value="{{ config('set.web_keywords_long') }}"/>
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>

                    <div class="form-group pull-in clearfix">
                        <div class="col-sm-4">
                            <label>
                                网站邮箱
                                {{--<small class="text-small">调用方式: {{ '{' }}{ config('set.web_email') }}</small>--}}
                            </label>
                            <input type="text" class="form-control parsley-validated"
                                   name="web_email" value="{{ config('set.web_email') }}" placeholder="请填写网站邮箱">
                        </div>
                        <div class="col-sm-4">
                            <label>
                                网站客服QQ
                                {{--<small class="text-small">调用方式: {{ '{' }}{ config('set.web_kf') }}</small>--}}
                            </label>
                            <input name="web_kf" id="tagsinput_web_kf" class="tagsinput" type="text"
                                   value="{{ config('set.web_kf') }}"/>
                        </div>
                        <div class="col-sm-4">
                            <label>
                                联系电话
                                {{--<small class="text-small">调用方式: {{ '{' }}{ config('set.web_phone') }}</small>--}}
                            </label>
                            <input type="text" class="form-control parsley-validated" data-required="true"
                                   name="web_phone" value="{{ config('set.web_phone') }}" placeholder="请填写网站联系电话">
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>

                    <div class="form-group pull-in clearfix">
                        <div class="col-sm-6">
                            <label>
                                经营地区
                            </label>
                            <div class="clearfix"></div>
                            <select style="width:100%" multiple class="chosen-select srcarea">
                                @foreach( $areas as $lv => $chunk )
                                    @foreach($chunk as $area)
                                        <option value="{{ $area['id'] }}" {{ array_search($area['id'],explode(',',config('set.web_area'))) !== false?'selected':'' }}>{{ $area['name'] }}</option>
                                    @endforeach
                                @endforeach
                            </select>
                        </div>
                        <input type="hidden" name="web_area" value="">
                        <div class="col-sm-6">
                            <label>
                                手机站模版
                                <small class="text-small">可以选择手机站的模版</small>
                            </label>
                            <div class="clearfix"></div>
                            <select style="width:100%" class="chosen-select" name="wap_theme">
                                @foreach($wap_theme as $value)
                                    <option value="{{ basename($value) }}" {{ config('set.wap_theme')==basename($value)?'selected':'' }}>
                                        {{ basename($value) }}
                                        <small class="text-small">(模版位于:{{ $value }})</small>
                                    </option>
                                @endforeach
                            </select>
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>

                    <div class="form-group pull-in clearfix">
                        <div class="col-sm-6">
                            <label>
                                网站百度统计地址
                                <small class="text-small">
                                    <a class="text-info" href="https://tongji.baidu.com/web/homepage/index">前往获取</a>
                                </small>
                            </label>
                            <input type="text" class="form-control parsley-validated" data-type="url"
                                   data-required="true"
                                   name="web_count_url" value="{{ config('set.web_count_url') }}"
                                   placeholder="请填写网站百度统计地址">
                        </div>
                        <div class="col-sm-6">
                            <label>
                                百度主动推送token
                                <small class="text-small">
                                    <a class="text-info" href="http://zhanzhang.baidu.com/dashboard/index">前往获取</a>
                                    添加本网站域名,并得到token
                                </small>
                            </label>
                            <input type="text" class="form-control parsley-validated"
                                   name="push_token" value="{{ config('set.push_token') }}"
                                   placeholder="请填写百度主动推送token">
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>

                    <div class="form-group">
                        <label>
                            网站百度统计代码
                            <small class="text-small">
                                <a class="text-info" href="http://zhanzhang.baidu.com/dashboard/index">前往获取</a>
                            </small>
                        </label>
                        <textarea class="form-control parsley-validated" rows="6" data-required="true"
                                  name="web_count_code"
                                  placeholder="请填写网站百度统计代码">{{ config('set.web_count_code') }}</textarea>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>

                    <div class="form-group">
                        <label>
                            网站描述
                            {{--<small class="text-small">调用方式: {{ '{' }}{ config('set.web_description') }}</small>--}}
                        </label>
                        <textarea class="form-control parsley-validated" rows="6" data-required="true"
                                  name="web_description"
                                  placeholder="请填写网站描述">{{ config('set.web_description') }}</textarea>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>

                    <div class="checkbox i-checks">
                        <label>
                            <input type="checkbox" name="wap_jump" {{ (bool)config('set.wap_jump')? 'checked' : '' }}
                            class="parsley-validated"><i></i>勾选此项,即开启 手机站
                        </label>
                    </div>
                    <div class="checkbox i-checks">
                        <label>
                            <input type="checkbox" name="301jump" {{ (bool)config('set.301jump')? 'checked' : '' }}
                            class="parsley-validated"><i></i>勾选此项,即开启 网站301跳转
                        </label>
                    </div>
                    <div class="checkbox i-checks">
                        <label>
                            <input type="checkbox" name="onepage" {{ (bool)config('set.onepage')? 'checked' : '' }}
                            class="parsley-validated"><i></i>勾选此项,即开启 单页跳转
                        </label>
                    </div>
                </div>
                <footer class="panel-footer text-right bg-light lter">
                    <button type="submit" class="btn btn-success btn-s-xs gatherInfo">保存</button>
                </footer>
            </section>
        </form>
    </div>
@endsection

@section('css')
    <link rel="stylesheet" href="/public/theme/js/chosen/chosen.css" type="text/css"/>
@endsection

@section('js')
    <!-- Chosen -->
    <script src="/public/theme/js/chosen/chosen.jquery.min.js"></script>
    <!-- parsley -->
    <script src="/public/theme/js/parsley/parsley.min.js"></script>
    <script src="/public/theme/js/parsley/parsley.extend.js"></script>
    <!-- tagsinput -->
    <script src="/public/theme/js/tagsinput/bootstrap-switch.js"></script>
    <script src="/public/theme/js/tagsinput/jquery.tagsinput.js"></script>
    <script src="/public/theme/js/tagsinput/form-component.js"></script>
    <!-- file input -->
    <script src="/public/theme/js/file-input/bootstrap-filestyle.min.js"></script>

    <script type="text/javascript">
        $('.gatherInfo').click(function () {
            var need = '';
            $('a.search-choice-close').each(function () {
                var order = $(this).attr('data-option-array-index');
                var id = $('.srcarea').find('option:eq(' + order + ')').val();
                need += id + ',';
            })
            $('input[name="web_area"]').val(need);
        });
    </script>
@endsection